package com.li.controller.kafka;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

/**
 * @author lirenchun
 */
@Component
public class Listener {

  /*  *//**
     * 同一Topic的一条消息只能被同一个GroupId内的一个Consumer消费----单播
     * 但多个不同的GroupId可同时消费同一个Topic的每一条消息----------广播
     *//*
    @KafkaListener(topics = "demo")
    public void lpRegister(ConsumerRecord<String, String> message) {
        System.out.println("1");
        String topic = message.topic();
        System.out.println("topic:" + topic);
        System.out.println("消息体:" + message.value());
    }

    @KafkaListener(topics = "demo")
    public void lpRegister2(ConsumerRecord<String, String> message) {
        System.out.println("2");
        String topic = message.topic();
        System.out.println("topic:" + topic);
        System.out.println("消息体:" + message.value());
    }*/

}
